<template>
  <div class="table-page-search-wrapper">
    <el-form :model="form" ref="form" :inline="true">
      <el-row :gutter="16">
        <el-col :span="6">
          <el-form-item label="部门">
            <dept-select ref="deptSelect" @select="handleDeptSelect" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item class="mb0" label="是否要求护士回访" prop="revisitNurse">
            <el-select clearable v-model="form.revisitNurse" placeholder="请选择">
              <el-option :value="0" label="否" />
              <el-option :value="1" label="是，非强制" />
              <el-option :value="2" label="强制" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item class="mb0" label="是否要求医生回访" prop="revisitDoctor">
            <el-select clearable v-model="form.revisitDoctor" placeholder="请选择">
              <el-option :value="0" label="否" />
              <el-option :value="1" label="是，非强制" />
              <el-option :value="2" label="强制" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item class="mb0">
            <el-tooltip class="item" effect="dark" content="查询" placement="top">
              <el-button type="primary" @click="handleSearch" icon="el-icon-search" />
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="重置" placement="top">
              <el-button @click="handleReset" icon="el-icon-refresh-right" />
            </el-tooltip>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import DeptSelect from '@/components/DeptSelect'
export default {
  components: {
    DeptSelect
  },
  data() {
    return {
      form: {
        revisitNurse: null
      }
    }
  },
  methods: {
    handleDeptSelect(value) {
      this.$set(this.form, 'deptId', value.id)
    },
    handleSearch() {
      this.$emit('search', this.form)
    },
    handleReset() {
      this.$refs.form.resetFields()
      this.$refs.deptSelect.reset()
      this.$set(this.form, 'deptId', null)
      this.$emit('search', this.form)
    }
  }
}
</script>
